export default {
    getParamsString:getParamsString
}

function getParamsString(params){
    const dic = Object.keys(params).sort();
    let str = '';
    for(const key in dic){
        var value = params[dic[key]];
        if (Object.prototype.toString.call(value) === '[object Array]') {
            str += '&' + dic[key] + '=' + '[';
            for (const index in value) {
                const indexValue = value[index];
                str += '"' + indexValue + '",'
            }
            str = str.substring(0, str.length-1);
            str += ']'
        } else {
            str += '&' + dic[key] + '=' + params[dic[key]];
        }
    }
    return str.substr(1);
}